<template>
  <div class="content">
    <span class="title">{{content.title}}</span>
    <div  style="width: 100%" class="scroll-view_H">
      <div class="scroll-view-item_H" v-for="item in travlelist">
        <img :src="item.thumbnail" style="display:block;width: 126.5px;height: 116px;border-radius: 8px 8px 0px 0px;"></img>
        <div class="travel_info_content">
          <span class="travle_name">{{item.name}}</span>
          <div class="point_content">
            <span class="point_text">{{item.score}}.0</span>
            <img v-for="item1 in item.number" :src="item1" class="point_image"></img>
          </div>
        </div>
      </div>
    </div>
  </div>

</template>

<script>
import {list} from '@/api/scenic'
import utils from "@/utils/utils";
export default {
name: "travleRow",
  props:[
    'content'
  ],
  data(){
  return{
    travlelist:[]
  }
  },
  created() {
  this.loadList()
  },
  methods:{
    loadList(){
      list().then(res=>{
        res.data.data.forEach(item=>{
          item.thumbnail=utils.thumbnail(item.thumbnail, 253, 232)
          if(utils.isNull(item.score)){
            item.score=0
          }else{
            item.score=Number(item.score).toFixed(0)
          }
          item.number=[]
          for(var i=0;i<5;i++){
            if(i<item.score){
              item.number.push('https://rzico.oss-cn-shenzhen.aliyuncs.com/dinnerBar/ic_list_star_red%402x.png')
            }else{
              item.number.push('http://rzico.oss-cn-shenzhen.aliyuncs.com/dinnerBar/dingdan/bddd9200c54aea2f8e84ca2b75a0ee8.png')
            }

          }
          this.travlelist.push(item)
        })
      })
    },
  }
}
</script>

<style scoped>
/* pages/index/component/travleRow/travleRow.wxss */
.content{
  background: #F5F5F5;
  padding-top: 5.5px;
  padding-bottom: 5.5px;
  padding-right: 10px;
  padding-left: 10px;
}
.title{
  color: #333333;
  font-weight: bold;
  font-size: 16px;
}
.scroll-view_H{
  overflow-x:auto ;
  white-space: nowrap;
  margin-top:12px;
}
.scroll-view-item_H{
  display: inline-block;
  margin-right: 7.5px;

}
.travel_info_content{
  background: white;
  padding: 10px;
  box-sizing: border-box;
  border-radius: 0px 0px 8px 8px;
}
.point_content{
  display: flex;
  align-items: center;
}
.travle_name{
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #333333;
  font-size: 12px;
}
.point_text{
  color: #FE0000;
  font-weight: bold;
  font-size: 12px;

}
.point_image{
  width: 9.5px;
  height: 8.5px;
  margin-left: 4px;
}

</style>
